import { verify } from '@/domain/authority/api/login';
import fetch from '@/domain/authority/api/index';
import { getCookie } from '@/utils/cookies';
import { getBaseUrl, getQueryVariable } from '@/utils/http';
import { defineComponent, onMounted, ref } from 'vue';

const Home = defineComponent({
  props: {},
  setup() {
    const classA = ref('');
    onMounted(async () => {
      const token = getQueryVariable('token');
      const param = getQueryVariable('param');
      if (token) {
        await verify(token);
      }
      // httpOnly 暂时不设置 Authorization
      // const user_token = getCookie('user_token');
      // fetch.changeAxiosHeaderCommon('Authorization', user_token);
      window.location.replace(getBaseUrl('') + '/teacherCharge/htmlEnter/index.html#/select');
    });
    return () => <div class={classA}></div>;
  }
});

Home.displayName = 'Home';

export default Home;
